﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Document_Left.aspx.cs" Inherits="DocumentManage_Document_Left" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
  <title>无标题页</title>
    <link href="../css/css.CSS" type="text/css" rel="stylesheet" /> 
    <script language ="javascript" type="text/javascript" >
    <!--  
    
function ck(obj,obj1)
{
  if(obj.lowsrc=="")
      return true;
  obj.imgRolln=obj.src;
  obj.src=obj.lowsrc;
  obj.lowsrc=obj.imgRolln;
  if(obj1.style.display=='none')
     obj1.style.display='';
  else
     obj1.style.display='none';
}

function showtree(space_c,ParentIDCol)
{
    //parent.form1.HChoiceOrgIDCol.value = "";   //清空上页面中的ID集合
    var aPCol = ParentIDCol.split(',');
    var iPcol = aPCol.length;
    for(m=0;m<iPcol;m++)
    {
      show_tree(space_c,aPCol[m]);
    }
}


var GOrgInfo = "" ;
//显示树型
function show_tree(space_c,ParentID)
{
  var i,j,k,img_src1,img_src2; 
  for(k=0;k<trees.length;k++)
  {
    if(trees[k].ParentID == ParentID ||  (trees[k].ChildNumber == "0" && trees[k].ID == ParentID ))
    {      
      document.write("<table border=0 cellspacing=0 cellpadding=0 bordercolor=#000000 width=100%><tr><td>");      
      for(i=1;i<=space_c;i++)
        document.write("&nbsp;&nbsp;");
        
      if(GOrgInfo!="")
      {
        if(trees[k].ID != ParentID)
        {
             //alert(trees[k].Name);
           img_src1="../SysManage/img/sys/close.gif"; 
           img_src2="../SysManage/img/sys/open.gif";
        } 
        var ary  = GOrgInfo.split(',');
        var nary = ary.length;
        for(i=0;i<nary-1;i++)
        { 
          if(trees[k].ID == ary[i])
          {
            //alert(ary[i]+","+ParentID);
            img_src1="../SysManage/img/sys/open.gif";
            img_src2="../SysManage/img/sys/close.gif"; 
          }
          if(trees[k].ParentID == ary[i])
          {  //alert(ary[i]+","+ParentID);
             img_src1="../SysManage/img/sys/close.gif"; 
             img_src2="../SysManage/img/sys/open.gif";
           }             
        }        
      }
      else
      {
         img_src1="../SysManage/img/sys/close.gif"; 
         img_src2="../SysManage/img/sys/open.gif";
      }        

      
      if(trees[k].ChildNumber=="0")
      {
        img_src1="../SysManage/img/sys/open.gif";        
        img_src2="../SysManage/img/sys/open.gif";
      }
     
      document.write("<img lowsrc=" + img_src2 + " id=\"img_"+trees[k].ID+"\" onclick=\"ck(this,document.all.T" + trees[k].ID + ");\" src=" + img_src1 + " align=middle>&nbsp;<a  style=\"cursor:pointer\" onclick=\"tog(this,'#f3f3f3');sendCtrlNodeInfo('" + trees[k].ID + "','" + trees[k].ParentID + "','" + trees[k].Name +  "','" + trees[k].Path +  "','" + trees[k].PaterPath +  "'); \" >" + trees[k].Name + "</a></td></tr></table>");
      document.write ("<span id='T" + trees[k].ID + "' style='display:none'>" );
      if(trees[k].ChildNumber != "0")
      {
        show_tree(space_c +1 ,trees[k].ID);
      }  
      document.write ("</span>");     
    }
  }
}
//点击事件
function sendCtrlNodeInfo(sID,sPaterID,sName,Path,PaterPath)
{
  hidform.HID.value = sID;
  hidform.HPaterID.value = sPaterID;
  hidform.HName.value = sName;
  hidform.HPath.value = Path;
  hidform.HPaterPath.value = PaterPath;
  eval("parent.RightFrame.location.href = \"Document_List.aspx?stype=1&ID="+sID+"\";");
}

//自动展开新所有上级  OrgID是要展开的组织
function GetSuperOrgID(OrgID)   //取得上级部门ID的集合.为展开树做准备的.
{
  var k;
  for(k=0;k<trees.length;k++)
  {
    var TempStr = "";
    if(trees[k].ID == OrgID)   //当前组织的ID
    {
      TempStr = TempStr + trees[k].ID + ",";
      GetSuperOrgID(trees[k].ParentID);
      GOrgInfo = GOrgInfo + TempStr ;
    }
  }
  //hidform.hOrgInfo1.value =  GOrgInfo;
  //SpreadNewOrgTree();
}

//展开一个新树

function SpreadNewOrgTree()
{  
  var i,j,k,img_src1,img_src2;
      if(GOrgInfo!="")
      {
        var ary  = GOrgInfo.split(',');
        var nary = ary.length;
        for(i=0;i<nary-1;i++)
        {
          eval("document.all.T"+ary[i]+".style.display=''");
        } 
      }
      else
      {
        //alert(GOrgInfo);
      }
}


///////////////////////////////////////项目树///////////////////////////////////

function Projectck(obj,obj1)
{
  if(obj.lowsrc=="")
      return true;
  obj.imgRolln=obj.src;
  obj.src=obj.lowsrc;
  obj.lowsrc=obj.imgRolln;
  if(obj1.style.display=='none')
     obj1.style.display='';
  else
     obj1.style.display='none';
}

var GProjectInfo = "" ;
//显示树型
function show_Projecttree(space_c,ParentID)
{
  var i,j,k,img_src1,img_src2; 
  for(k=0;k<Projecttrees.length;k++)
  {
    if(Projecttrees[k].ParentID == ParentID ||  (Projecttrees[k].ChildNumber == "0" && Projecttrees[k].ID == ParentID ))
    {      
      document.write("<table border=0 cellspacing=0 cellpadding=0 bordercolor=#000000 width=100%><tr><td>");      
      for(i=1;i<=space_c;i++)
        document.write("&nbsp;&nbsp;");
        
      if(GProjectInfo!="")
      {
        if(Projecttrees[k].ID != ParentID)
        {
             //alert(trees[k].Name);
           img_src1="../SysManage/img/sys/close.gif"; 
           img_src2="../SysManage/img/sys/open.gif";
        } 
        var ary  = GProjectInfo.split(',');
        var nary = ary.length;
        for(i=0;i<nary-1;i++)
        { 
          if(Projecttrees[k].ID == ary[i])
          {
            //alert(ary[i]+","+ParentID);
            img_src1="../SysManage/img/sys/open.gif";
            img_src2="../SysManage/img/sys/close.gif"; 
          }
          if(Projecttrees[k].ParentID == ary[i])
          {  //alert(ary[i]+","+ParentID);
             img_src1="../SysManage/img/sys/close.gif"; 
             img_src2="../SysManage/img/sys/open.gif";
           }             
        }        
      }
      else
      {
         img_src1="../SysManage/img/sys/close.gif"; 
         img_src2="../SysManage/img/sys/open.gif";
      }        

      
      if(Projecttrees[k].ChildNumber=="0")
      {
        img_src1="../SysManage/img/sys/open.gif";        
        img_src2="../SysManage/img/sys/open.gif";
      }
     
      document.write("<img lowsrc=" + img_src2 + " id=\"img_"+Projecttrees[k].ID+"\" onclick=\"Projectck(this,document.all.ProjectT" + Projecttrees[k].ID + ");\" src=" + img_src1 + " align=middle>&nbsp;<a  style=\"cursor:pointer\" onclick=\"tog(this,'#f3f3f3');sendProjectCtrlNodeInfo('" + Projecttrees[k].ID + "','" + Projecttrees[k].ParentID + "','" + Projecttrees[k].Name +  "','" + Projecttrees[k].Path +  "','" + Projecttrees[k].PaterPath +  "'); \" >" + Projecttrees[k].Name + "</a></td></tr></table>");
      document.write ("<span id='ProjectT" + Projecttrees[k].ID + "' style='display:none'>" );
      if(Projecttrees[k].ChildNumber != "0")
      {
        show_Projecttree(space_c +1 ,Projecttrees[k].ID);
      }  
      document.write ("</span>");     
    }
  }
}
//点击事件
function sendProjectCtrlNodeInfo(sID,sPaterID,sName,Path,PaterPath)
{
  hidform.HID.value = sID;
  hidform.HPaterID.value = sPaterID;
  hidform.HName.value = sName;
  hidform.HPath.value = Path;
  hidform.HPaterPath.value = PaterPath;
  eval("parent.RightFrame.location.href = \"Document_List.aspx?stype=2&ID="+sID+"\";");
}

//自动展开新所有上级  OrgID是要展开的组织
function GetSuperProjectID(OrgID)   //取得上级部门ID的集合.为展开树做准备的.
{
  var k;
  for(k=0;k<Projecttrees.length;k++)
  {
    var TempStr = "";
    if(Projecttrees[k].ID == OrgID)   //当前组织的ID
    {
      TempStr = TempStr + Projecttrees[k].ID + ",";
      GetSuperProjectID(Projecttrees[k].ParentID);
      GProjectInfo = GProjectInfo + TempStr ;
    }
  }
  //hidform.hOrgInfo1.value =  GOrgInfo;
  //SpreadNewOrgTree();
}

//展开一个新树

function SpreadNewProjectTree()
{  
  var i,j,k,img_src1,img_src2;
      if(GProjectInfo!="")
      {
        var ary  = GProjectInfo.split(',');
        var nary = ary.length;
        for(i=0;i<nary-1;i++)
        {
          eval("document.all.ProjectT"+ary[i]+".style.display=''");
        } 
      }
      else
      {
        //alert(GOrgInfo);
      }
}


var tgs; 
var tmp_background_val; 
function tog(n,flags)
{ 
  if (tgs)
  { 
    tgs.style.background= tmp_background_val ; 
  } 
  n.style.background= '#99ccff'; 
  tmp_background_val=flags;
  tgs=n; 
} 
-->
    </script>    
</head> 
    <body style =" background-image :url('../images/hit_bg.gif');"> 
      <table cellpadding ="0" cellspacing ="0" width="98%" align="center" >
       <tr>
        <td>
          <input type="radio" id="RaDoc" checked ="checked"  value ="1" name ="RadioGroup"  onclick ="if(this.checked==true){divDoc.style.display='';divProject.style.display='none';}else{divDoc.style.display='none';divProject.style.display='';}"   />资料树
          <input type="radio" id="RaProject" value ="2"  name ="RadioGroup" onclick ="if(this.checked==true){divDoc.style.display='none';divProject.style.display='';}else{divDoc.style.display='';divProject.style.display='none';}" />项目树</td>
       </tr>
       <tr>
         <td><hr /></td>
       </tr>
       <tr>       
        <td>
            <div id="divDoc" style="" ><%=sDeptHtml%></div>
            <div id="divProject" style="DISPLAY:none ;" ><%=sProjectHtml%></div> </td>        
       </tr>
      </table> 
      <form id = "hidform" method="post" runat ="server">
        <input type="hidden" id="HID" runat ="server" />
        <input type="hidden" id="HPaterID" runat ="server" />
        <input type="hidden" id="HName" runat ="server" />
        <input type="hidden" id="HPath" runat ="server" />
        <input type="hidden" id="HPaterPath" runat ="server" />
        <input type="hidden" id="HRootPath" runat ="server" />
      </form>
  </body>
</html>